However, file is created by File.mkdir (), which creates a new folder exception if the parent directory does not exist. So before downloading we'd better call the file's Mkdirs method recursively create a subdirectory
Mkdirs () can establish
Context path to Environment file access is obtained through and related methods.With these two classes, you get a variety of paths, ($rootDir) +-/data-environment.getdatadirectory () | || | ($appDataDir) | +-data/com.srain.cube.sample| || | ($filesDir) | +-Files, Context.getfilesdir ()/Context.getfilestreampath ("") | | || | +-File1-Context.getfilestreampath ("File1") | | ($cacheDir) | +-Cache-Context.getcachedir () |
(); } }}
the law of the pathGenerally, the Context path to Environment file access is obtained through and related methods.With these two classes, you get a variety of paths,($rootDir) +-/data, environment.getdatadirectory () | || | ($appDataDir) | +-data/com.srain.cube.sample| || | ($filesDir) | + + files, Context.getfilesdir ()/Context.getfilestreampath ("")| | || | +-File1-Context.getfilestreampath ("File1") | | ($cacheDir) | +-Context.getcachedir () | | | + App_
The system data storage path is as follows: where the application package name is: COM.SPTThe Contextwrapper class contains the following methods:1. Getfilesdir ()--Internal storage @Override public File Getfilesdir () { return mbase.getfilesdir (); }Data storage path on K86M_QC machine:/data/data/com.spt/filesData storage path on Huawei Mobile:/data/data/com.spt/files2. The Getexternalfilesdir (String type) parameter is specified as: environment.directory_pictures external stora
()| +- ???Characteristics of each pathThe following describes the characteristics of these paths and the details to be aware of in use:1. root directory ( $rootDir ):
Internal storage path: /data , by Environment.getDataDirectory() getting
External storage path: /storage/sdcard0 (also similar to/mnt/), by Environment.getExternalStorageDirectory() obtaining
Example environment.getdatadirectory (): /dataenvironment.getexter
(); } else { if (!path.exists()) { return 0; } else { final StatFs stats = new StatFs(path.getPath()); return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); } }}
The law of the pathGenerally, the Context path to Environment file access is obtained through and related methods.With these two classes, you get a variety of paths, ($rootDir) +-/data environment.getdatadirectory ()| || | ($appD
(refers to the platform signature, or pre-installed in the/system/priv-app directory application) can be used to obtain full access to the SD card by using Write_media_storage permissions.
Android 4.4 Adds the following function to access external storage:
Context.getexternalfilesdirs (NULL), returns the files directory of the application private data area for multiple SD cards
/storage/sdcard0/android/data//storage/sdcard1/android/data/
Context.
Http://mobile.51cto.com/abased-375025.htmhttp://blog.sina.com.cn/s/blog_7db304660100xgpp.html
Android/data: This is the cache path of the application. If you clear the cache of the application in the settings, the data in this directory will also be cleared, it is the same as data/package name /.
19:39:34-17. 681: I/Tag (8150): getexternalfilesdir (environment. directory_movies); =/storage/sdcard0/Android/data/COM. example. onlyfortest/files/Movies
(applications with a platform signature or pre-installed in the/system/priv-app directory) you can use the WRITE_MEDIA_STORAGE permission to obtain full read/write permissions for the SD card.
Android 4.4 adds the following functions to access external storage:
Context. getExternalFilesDirs (null), returns the files directory of the private data zone of the Application for multiple SD cards.
/Storage/sdcard0/Android/data//Storage/sdcard1/A
My red rice mobile phone, I have switched the internal and external storage location, sdcard0 is my 32G memory card, sdcard1 is the mobile phone's automatic SD card, only more than 900 m, after installing Baidu navigation, when downloading offline data packets, you accidentally select the internal storage when the software prompts you to store the data. The result is that you can only download the National Basic Package. If you want to continue downlo
Android 4.4, the System application (refers to the platform signature, or pre-installed in the/system/priv-app directory application) can be used to obtain full access to the SD card by using Write_media_storage permissions.
Android 4.4 Adds the following function to access external storage:
Context.getexternalfilesdirs (NULL), returns the files directory of the application private data area for multiple SD cards
/storage/sdcard0/android/data/
/s
method after the photo is completed. First we have to determine whether the ResultCode is equal to the RESULT_OK, only equal to indicate the success of the photo, and then we judge if the Requestcode equals request_code_image_capture, if the equality indicates the result of the photo return. So at this point, we can get the photo we just finished with the Imageoutputuri we stored before, and its URI string is as follows: file:///storage/sdcard0/Andro
that a large number of files were downloaded from my sd card (in sdcard0 \ baicizhan ), the size is not very big, that is, several hundred megabytes, but there are too many files and tens of thousands of files. As a result, the problem was found, that is, when the media scanned the SD card, due to too many files, resulting in scanning blocking, occupying resources, resulting in fever. The cause is found, and the problem also arises. Since this servi
of Root fold, find vold.fstab files, long Press pop-up menu, select the last File Builder (Open in TextEditor)
3, find the following statement
Dev_mount sdcard/storage/sdcard0 Emmc@fat
/devices/platform/goldfish_mmc.0
/devices/platform/mtk-msdc.0/mmc_host
(This is the phone's default storage card)
Dev_mount
Sdcard2/storage/sdcard1 Auto
/devices/platform/goldfish_mmc.1
/devices/platform/mtk-msdc.1/mmc_host
(This is an external SD card)
4
photographing.
We OverwriteonActivityResultMethod. First, we need to determineresultCodeWithRESULT_OKEqual. Only equal indicates that the photo was taken successfully.requestCodeEqualREQUEST_CODE_IMAGE_CAPTUREIf they are equal, the result is returned by the photo. In this case, we can use the previously stored imageOutputUri to obtain the photo we just took. Its URI string is as follows:File: // storage/sdcard0/Android/data/com. ispring. commonintent
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.